from alipay import AliPay
from alipay.utils import AliPayConfig
from . import setting

alipay = AliPay(
    appid=setting.APPID,
    app_notify_url=None,  # 默认回调url
    app_private_key_string=setting.APP_PRIVATE_KEY_STRING,
    # 支付宝的公钥，验证支付宝回传消息使用，不是你自己的公钥,
    alipay_public_key_string=setting.ALIPAY_PUBLIC_KEY_STRING,
    sign_type=setting.SIGN_TYPE,  # RSA 或者 RSA2
    debug=setting.DEBUG,  # 默认False
    verbose=False,  # 输出调试数据
    config=AliPayConfig(timeout=15)  # 可选, 请求超时时间
)


# 支付宝网关
# alipay_gatewal_url = 'https://openapi.alipaydev.com/gateway.do?'
gateway = setting.ALIPAY_GATEWAL_URL

